/*
 * Copyright (C) 2004, Velocityme Partnership
 * TaskValueToString.java
 *
 * Created on 22 November 2004, 05:23
 */

package com.velocityme.valueobjects;

/**
 *
 * @author  Robert
 */
public class TaskValueToString extends TaskValue {
    
    /** Creates a new instance of TaskValueToString */
    public TaskValueToString(TaskValue p_value) {
        super(p_value);
    }
    
    public String toString() {
        return getNodeValue().getName();
    }
    
    static public String toString(TaskValue p_value) {
        return p_value.getNodeValue().getName();
    }
    
    static public String expectedDurationToString(TaskValue p_value) {
        int totalMins = p_value.getExpectedDuration_min().intValue();
        return expectedDurationToString(totalMins);
    }
    
    static public String expectedDurationToString(int totalMins) {
        int minutes = totalMins % 60;
        int hours = (totalMins / 60) % 8;
        int days = totalMins / (8 * 60);
        return Integer.toString(days) + "day:" + Integer.toString(hours) + "hr:" + Integer.toString(minutes) + "min";
    }

}
